﻿<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
	<meta charset="utf-8" />
    <script src="Scripts/jquery-1.11.3.js"></script>
</head>
<body>
    <div>
        <button type="button" id="btn1">测试1</button>
        <button type="button" id="btn2">测试1</button>
        <button type="button" id="btn22">测试1</button>
        <button type="button" id="btn3">测试1</button>
        <button type="button" id="btn33">测试1</button>
        <button type="button" id="btn">打印</button>
    </div>
    <script>
        $(function () {
            var data = { x: 1};

            $("#btn1").on("click", data, function (event) {
                //var d = event.data.x;
                event.data.x = 2;
            });

            $("#btn2").on("click", data, function (event) {
                var d = event.data;
                d.x = 3;
            });
            $("#btn22").on("click", data, function (event) {
                var d = event.data.x;
                d = 33;
            });

            $("#btn3").on("click", data, function (event) {
                var d = event.data;
                text(d);
            });
            $("#btn33").on("click", data, function (event) {
                var d = event.data.x;
                text2(d);
            });
            function text(val) {
                val.x = "text";
            }
            function text2(val) {
                val = "text2";
            }


            $("#btn").on("click", data, function (event) {
                var d = event.data.x;

                console.log(d);
                console.log(data.x);
            });
        });
    </script>
</body>
</html>
